package com.gears_software.bbnetwork.adapters;

import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import com.gears_software.bbnetwork.datas.models.CurrentBankInfoModel;
import com.gears_software.bbnetwork.views.CardItemView;
import com.gears_software.bbnetwork.views.CardItemView_;
import com.gears_software.common.R;
import com.gears_software.common.utils.SwipeRefreshLoadListView.swipe.adapters.BaseSwipeAdapter;

public class CardItemAdapter extends BaseSwipeAdapter {

	List<CurrentBankInfoModel> list;
	Context context;
	Activity activity;
	public CardItemAdapter(List<CurrentBankInfoModel> list, Context context,Activity activity) {
		super();
		this.list = list;
		this.context = context;
		this.activity = activity;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public CurrentBankInfoModel getItem(int arg0) {
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public int getSwipeLayoutResourceId(int position) {
		return R.id.swipe;
	}

	@Override
	public View generateView(int position, ViewGroup parent) {
		return null;
	}

	@Override
	public void fillValues(int position, View convertView) {
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		CardItemView view = null;
		if(convertView==null){
			view = CardItemView_.build(context);
		}else{
			view = (CardItemView) convertView;
		}
		view.bind(getItem(position),activity);
		return view;
	}

}
